<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class CateModel extends Model
{
    //
    protected $table = 'cate';

    public $timestamps = false;

    //插入分类
    public function insertCate($data) {
        $res = self::insert($data);
        return $res;
    }

    //查询所有的分类
    public function getCates() {
        $res = self::get()->toArray();
        return $res;
    }

    //查询一条分类
    public function getCate($id) {
        $res = self::find($id)->toArray();
        return $res;
    }

    //更新分类
    public function upCate($id , $data) {
        $res = self::where('id' , $id)->update($data);
        return $res;
    }

    //删除分类
    public function delCate($id) {
        $res = self::destroy($id);
        return $res;
    }
}
